package day20;

import java.util.Scanner;

public class Exception {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            System.out.println("请输入你心仪女朋友的姓名: ");
            String name = sc.nextLine();
            if(name.matches("[\\D]{3,10}")) break;
            System.out.println("输入异常");
        }
        while(true) {
            System.out.println("请输入你心仪女朋友的年龄: ");
            int age = sc.nextInt();
            if(age>=18&&age<=30) break;
            System.out.println("输入异常");
        }
    }
}
